local skel = fk.CreateSkill{
  name = "lb__kouji",
   tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["lb__kouji"] = "叩寂",
  [":lb__kouji"] = "<b>锁定技</b>，每阶段限一次，你获得牌后，你重铸之并摸一张牌。",

  ["$lb__kouji1"] = "别担心，闭上双眼。",
  ["$lb__kouji2"] = "长夜将临，正适合一场美梦。",
  ["$lb__kouji3"] = "诸位，后会有期~",
}

skel:addEffect(fk.AfterCardsMove, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and player:usedSkillTimes(skel.name, Player.HistoryPhase) < 1 then
      for _, move in ipairs(data) do
        if move.to == player and move.toArea == Card.PlayerHand then
          local cards = {}
          for _, info in ipairs(move.moveInfo) do
            if table.contains(player:getCardIds("he"), info.cardId) then
              table.insert(cards, info.cardId)
            end
          end
          if #cards > 0 then
            event:setCostData(self, {cards = cards})
            return true
          end
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = event:getCostData(self).cards
    cards = table.filter(player:getCardIds("he"), function (id)
      return table.contains(cards, id)
    end)
    if #cards > 0 then
      room:recastCard(cards, player, skel.name)
      if not player.dead then
        player:drawCards(1, skel.name)
      end
    end
  end,
})

return skel